export function FileSlicer(file) {

    // randomly picked 3MB slices,
  // I don't think this size is important for this experiment
  this.sliceSize = 1024*1024*1;
  this.slices = Math.ceil(file.size / this.sliceSize);

  this.currentSlice = 0;

  this.getNextSlice = function() {
    var start = this.currentSlice * this.sliceSize;
    var end = Math.min((this.currentSlice+1) * this.sliceSize, file.size);
    ++this.currentSlice;

    return file.slice(start, end);
  }
}

export function saveByteArray(reportName, byte, options = {}) {
  var blob = new Blob([byte], options);
  var link = document.createElement('a');
  link.href = window.URL.createObjectURL(blob);
  var fileName = reportName;
  link.download = fileName;
  link.click();
}